package com.ruoyi.repay.service.impl;

import com.ruoyi.repay.domain.RepaymentPlan;
import com.ruoyi.repay.domain.RepaymentSchedule;
import com.ruoyi.repay.domain.vo.ResultVo;
import com.ruoyi.repay.mapper.RepaymentscheduleMapper;
import com.ruoyi.repay.service.RepaymentscheduleService;
import com.ruoyi.repay.utils.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class RepaymentscheduleServiceImpl implements RepaymentscheduleService {
    @Autowired
  private RepaymentscheduleMapper repaymentscheduleMapper;
    @Override
    public ResultVo addrepaymentschedule(RepaymentSchedule repaymentSchedule) {
//        IdWorker idWorker = new IdWorker();
//        String outTradeNo = Long.toString(idWorker.nextId());
//        repaymentSchedule.setCode(outTradeNo);
//
        repaymentSchedule.setCreateTime(new Date());
        repaymentscheduleMapper.addrepaymentschedule(repaymentSchedule);
        return new ResultVo(200, "添加成功", null);
    }

    @Override
    public ResultVo repayList(String userInfoCode) {
        List<RepaymentSchedule> list =  repaymentscheduleMapper.repayList(userInfoCode);
        System.out.println(list+"======================");
        return new ResultVo(200, "查询成功", list);
    }
}
